[LIBXC] Python error extraction tweak.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Thu, 7 Dec 2006 11:46:07 +0000 (11:46 +0000)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Thu, 7 Dec 2006 11:46:07 +0000 (11:46 +0000)
Signed-off-by: Keir Fraser <keir@xensource.com>
tools/python/xen/lowlevel/xc/xc.c

index be02bf8ed8eb8e2d0fa571ae18a575840e07f1b8..e74a882fe073f367f4dfe37a15dd511d467c1fac 100644 (file)
@@ -46,7 +46,10 @@ static PyObject *pyxc_error_to_exception(void)
     const xc_error const *err = xc_get_last_error();
     const char *desc = xc_error_code_to_desc(err->code);
 
-    if (err->message[1])
+    if (err->code == XC_ERROR_NONE)
+        return PyErr_SetFromErrno(xc_error_obj);
+
+    if (err->message[0] != '\0')
        pyerr = Py_BuildValue("(iss)", err->code, desc, err->message);
     else
        pyerr = Py_BuildValue("(is)", err->code, desc);